package com.hp.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hp.bean.Orders;
import com.hp.bean.OrdersExample;
import com.hp.mapper.OrdersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrdersServiceImpl implements OrdersService {
    @Autowired
    private OrdersMapper mapper;

    @Override
    public Orders findByid(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int upp(Orders obj) {
        return mapper.updateByPrimaryKeySelective(obj);
    }

    @Override
    public int del(Integer id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public PageInfo<Orders> pageFind(OrdersExample example, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<Orders> list = mapper.selectExample(example);
        PageInfo<Orders> pageInfo = new PageInfo<Orders>(list);
        return pageInfo;
    }

    @Override
    public List<Orders> selectOrdersList(Orders orders) {
        return mapper.selectOrdersList(orders);
    }

    @Override
    public int orderEnd(Orders obj) {
        return mapper.orderEnd(obj);
    }

    @Override
    public int sendMaster(Orders obj, Integer type) {
        return mapper.sendMaster(obj,type);
    }

    @Override
    public Orders selectOrdersByPhone(String phone) {
        return mapper.selectOrdersByPhone(phone);
    }

    @Override
    public int insertOrders(Orders obj) {
        return mapper.insertOrders(obj);
    }
}
